package com.sinsz.c.mongo.annotation;

import com.sinsz.c.mongo.base.BaseMongoRepository;
import com.sinsz.c.mongo.context.BxfsMongoAuditingRegister;
import com.sinsz.c.mongo.context.BxfsMongoRegister;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Import;
import org.springframework.data.mongodb.repository.support.MongoRepositoryFactoryBean;
import org.springframework.data.repository.query.QueryLookupStrategy;

import java.lang.annotation.*;

/**
 * 开启mongo数据支持
 * @author chenjianbo
 * @date 2017/11/24
 */
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Inherited
@Import(value = {BxfsMongoRegister.class, BxfsMongoAuditingRegister.class})
public @interface EnableBxfsMongo {

    /** 以下部分用于BxfsMongoRegister.class */

    String[] value() default {};

    String[] basePackages() default {"com.sinsz.c.mongo.repository"};

    Class<?>[] basePackageClasses() default {};

    ComponentScan.Filter[] includeFilters() default {};

    ComponentScan.Filter[] excludeFilters() default {};

    String repositoryImplementationPostfix() default "Impl";

    String namedQueriesLocation() default "";

    QueryLookupStrategy.Key queryLookupStrategy() default QueryLookupStrategy.Key.CREATE_IF_NOT_FOUND;

    Class<?> repositoryFactoryBeanClass() default MongoRepositoryFactoryBean.class;

    Class<?> repositoryBaseClass() default BaseMongoRepository.class;

    String mongoTemplateRef() default "mongoTemplate";

    boolean createIndexesForQueryMethods() default false;

    boolean considerNestedRepositories() default false;

    /** 以下用于BxfsMongoAuditingRegister.class */

    String auditorAwareRef() default "";

    boolean setDates() default true;

    boolean modifyOnCreate() default true;

    String dateTimeProviderRef() default "";
}